<template>
<div class="content">
    <mt-header fixed title="危险源详情">
              <div slot="left">
    <mt-button icon="back" @click.native="goback()">返回</mt-button>
              </div>
    </mt-header>
    <mt-cell title="危险源名称" :value="result.dresname" v-show="result.dresname"></mt-cell>
    <mt-cell title="危险源类型" :value="dresType(result.drestype)" v-show="result.drestype"></mt-cell>
    <mt-cell title="危险级别" :value="result.level" v-show="result.level"></mt-cell>
    <mt-cell title="所属监管单位" :value="result.supervisorname" v-show="result.supervisorname"></mt-cell>
    <mt-cell title="所在街道" :value="result.district" v-show="result.district"></mt-cell>
    <mt-cell title="详细地址" :value="result.address" v-show="result.address"></mt-cell>
    </div>
</template>
<script>
export default {
  data () {
    return {
      result: {},
      dres: ['', '油库', '烟花爆竹', '化工厂']

    }
  },
  created () {
    this.getdevicedetail()
  },
  methods: {
    async getdevicedetail () {
      const res = await this.$store.dispatch('dresoucetails', {
        dresourceid: this.$route.query.dresourceid
      })
      if (res.status === '0') {
        this.result = res.context
      }
    },
    goback () {
      this.$router.go(-1)
    },
    dresType (val) {
      if (!val) {
        return ''
      };
      return this.dres[val]
    }
  }

}
</script>
<style lang="less" scoped>
.content{
    padding-top: 40px;
}

</style>
